import { NotchAble } from "@/river-stock/core.define";
import { Paster } from "@/pond-asset/schema.default";
import { BIGINT_PG } from "./db.pg";

/** 元素是否选中 */
export type WithPicked<T> = T & { isPicked?: boolean };

/** 订单/商品/模板需要展示标签 */
export type WithPasterList = { withPasterTempList: Paster[] };

// ====================================
// ====================================
// ====================================
// ====================================
// ====================================
// ====================================

/** 账簿统计 */
type BookSummary = {
  amountA1: number;
  amountA2: number;
  amountA3: number;
  amountA4: number;
};
export type WithKeySortBook = keyof BookSummary;
export type WithBookSummary = BookSummary & {
  amount: number;
};

// ====================================
// ====================================
// ====================================
// ====================================
// ====================================
// ====================================

/** 商品上有哪些常规库存/冷卷库存 */
export type WithStockLs = {
  withCommonStockLs: NotchAble[];
};

/** 对库存进行统计 */
export type WithStockTotal = {
  /** 库存对象计数 */
  stockCounts?: number;
  stockTons?: number;

  /** 商品剩余 */
  withInOutCountTotal: BIGINT_PG;
  withInOutTonTotal: BIGINT_PG;

  /** 商品未入库 */
  withNotInCountTotal: BIGINT_PG;
  withNotInTonTotal: BIGINT_PG;

  /** 商品未加工 */
  withNotProcessCountTotal: BIGINT_PG;
  withNotProcessTonTotal: BIGINT_PG;

  /** 商品未发货 */
  withNotOutCountTotal: BIGINT_PG;
  withNotOutTonTotal: BIGINT_PG;
};

/** 库存排序 */
export type WithKeySortIv = keyof WithStockTotal;
